package com.fcscs.cservice.gwt.server;

import java.util.List;

import com.fcscs.core.gwt.server.FcsRemoteServiceServlet;
import com.fcscs.core.system.ApplicationContextHolder;
import com.fcscs.core.util.CommonUtil;
import com.fcscs.cservice.domain.PropertyConfigRestaurant;
import com.fcscs.cservice.domain.Restaurant;
import com.fcscs.cservice.domain.RestaurantConfig;
import com.fcscs.cservice.domain.model.RestaurantConfigModel;
import com.fcscs.cservice.domain.model.RestaurantConfiguration;
import com.fcscs.cservice.domain.model.RestaurantView;
import com.fcscs.cservice.gwt.client.RestaurantService;
import com.fcscs.cservice.service.RestaurantManager;

public class RestaurantServiceImpl extends FcsRemoteServiceServlet implements RestaurantService{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5396680181135078239L;
	private RestaurantManager rsMgr = (RestaurantManager) ApplicationContextHolder.getBeanFromContext("restaurantManager");
	
	@SuppressWarnings("unchecked")
	@Override
	public <E extends Restaurant> E get(E cls, long id) {
		return (E) rsMgr.get(cls.getClass(), id);
	}

	@Override
	public Restaurant get(long id) {
		return rsMgr.get(id);
	}

	@Override
	public Boolean delete(Restaurant loc) {
		return rsMgr.delete(loc);
	}

	@Override
	public void permDelete(Restaurant loc) {
		rsMgr.permDelete(loc);
	}

	@Override
	public <E extends Restaurant> E save(E loc) {
		return rsMgr.save(loc);
	}

	@Override
	public List<Restaurant> getRestaurants(long orgId, Long propId) {
		return rsMgr.getRestaurants(orgId, propId);
	}

	@Override
	public List<RestaurantView> getRestaurantViews(long orgId, Long propId) {
		return rsMgr.getRestaurantViews(orgId, propId);
	}

	@Override
	public RestaurantConfigModel saveRestaurantConfigModel(RestaurantConfigModel model) {
		return rsMgr.saveRestaurantConfigModel(model);
	}

	@Override
	public RestaurantConfigModel getRestaurantConfigModel(long orgId,Long propId) {
		return rsMgr.getRestaurantConfigModel(orgId, propId);
	}

	@Override
	public List<RestaurantConfig> getRestaurantConfig(Long propId,long restaId) {
		long orgId = CommonUtil.getUserContext().getOrgId();
		return rsMgr.getRestaurantConfig(orgId, propId, restaId);
	}

	@Override
	public RestaurantConfiguration saveRestaurantConfig(RestaurantConfiguration resc) {
		return rsMgr.saveRestaurantConfig(resc);
	}

	@Override
	public PropertyConfigRestaurant getPropertyConfigRestaurant(Long propetyId) {
		long orgId = CommonUtil.getUserContext().getOrgId();
		return rsMgr.getPropertyConfigRestaurant(orgId, propetyId);
	}

	@Override
	public PropertyConfigRestaurant savePropertyConfigRestaurant(PropertyConfigRestaurant propConfigRest) {
		return rsMgr.savePropertyConfigRestaurant(propConfigRest);
	}

}